.class public Lcom/openfeint/internal/JsonResourceParser;
.super Ljava/lang/Object;
.source "JsonResourceParser.java"


# static fields
.field private static final TAG:Ljava/lang/String; = "JsonResourceParser"


# instance fields
.field private mParser:Lorg/codehaus/jackson/JsonParser;


# direct methods
.method public constructor <init>(Lorg/codehaus/jackson/JsonParser;)V
    .locals 0
    .parameter "parser"

    .prologue
    .line 23
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 24
    iput-object p1, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    .line 25
    return-void
.end method

.method private parseArray()Ljava/util/ArrayList;
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/openfeint/internal/resource/Resource;",
            ">;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/codehaus/jackson/JsonParseException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 158
    iget-object v1, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v1}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v0

    .line 160
    .local v0, tok:Lorg/codehaus/jackson/JsonToken;
    sget-object v1, Lorg/codehaus/jackson/JsonToken;->VALUE_NULL:Lorg/codehaus/jackson/JsonToken;

    if-ne v0, v1, :cond_0

    const/4 v1, 0x0

    .line 166
    :goto_0
    return-object v1

    .line 162
    :cond_0
    sget-object v1, Lorg/codehaus/jackson/JsonToken;->START_ARRAY:Lorg/codehaus/jackson/JsonToken;

    if-eq v0, v1, :cond_1

    .line 163
    new-instance v1, Lorg/codehaus/jackson/JsonParseException;

    const-string v2, "Wanted START_ARRAY"

    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->getCurrentLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v3

    invoke-direct {v1, v2, v3}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v1

    .line 166
    :cond_1
    invoke-direct {p0}, Lcom/openfeint/internal/JsonResourceParser;->parseOpenedArray()Ljava/util/ArrayList;

    move-result-object v1

    goto :goto_0
.end method

.method private parseHash()Ljava/util/HashMap;
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Integer;",
            ">;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/codehaus/jackson/JsonParseException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 127
    iget-object v1, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v1}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v0

    .line 128
    .local v0, tok:Lorg/codehaus/jackson/JsonToken;
    sget-object v1, Lorg/codehaus/jackson/JsonToken;->VALUE_NULL:Lorg/codehaus/jackson/JsonToken;

    if-ne v0, v1, :cond_0

    const/4 v1, 0x0

    .line 131
    :goto_0
    return-object v1

    .line 129
    :cond_0
    sget-object v1, Lorg/codehaus/jackson/JsonToken;->START_OBJECT:Lorg/codehaus/jackson/JsonToken;

    if-eq v0, v1, :cond_1

    .line 130
    new-instance v1, Lorg/codehaus/jackson/JsonParseException;

    const-string v2, "Expected START_OBJECT"

    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->getCurrentLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v3

    invoke-direct {v1, v2, v3}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v1

    .line 131
    :cond_1
    invoke-direct {p0}, Lcom/openfeint/internal/JsonResourceParser;->parseOpenedHash()Ljava/util/HashMap;

    move-result-object v1

    goto :goto_0
.end method

.method private parseOpenedArray()Ljava/util/ArrayList;
    .locals 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/openfeint/internal/resource/Resource;",
            ">;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/codehaus/jackson/JsonParseException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 171
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    .line 173
    .local v0, resources:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/openfeint/internal/resource/Resource;>;"
    :goto_0
    iget-object v1, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v1}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v1

    sget-object v2, Lorg/codehaus/jackson/JsonToken;->END_ARRAY:Lorg/codehaus/jackson/JsonToken;

    if-ne v1, v2, :cond_0

    .line 177
    return-object v0

    .line 174
    :cond_0
    invoke-direct {p0}, Lcom/openfeint/internal/JsonResourceParser;->parseResource()Lcom/openfeint/internal/resource/Resource;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_0
.end method

.method private parseOpenedHash()Ljava/util/HashMap;
    .locals 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Integer;",
            ">;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/codehaus/jackson/JsonParseException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 135
    new-instance v1, Ljava/util/HashMap;

    invoke-direct {v1}, Ljava/util/HashMap;-><init>()V

    .line 137
    .local v1, resources:Ljava/util/HashMap;,"Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/Integer;>;"
    :goto_0
    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v3

    sget-object v4, Lorg/codehaus/jackson/JsonToken;->FIELD_NAME:Lorg/codehaus/jackson/JsonToken;

    if-eq v3, v4, :cond_0

    .line 143
    return-object v1

    .line 138
    :cond_0
    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->getText()Ljava/lang/String;

    move-result-object v0

    .line 139
    .local v0, className:Ljava/lang/String;
    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    .line 140
    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->getIntValue()I

    move-result v2

    .line 141
    .local v2, v:I
    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v0, v3}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_0
.end method

.method private parseOpenedResource(Lcom/openfeint/internal/resource/ResourceClass;)Lcom/openfeint/internal/resource/Resource;
    .locals 12
    .parameter "resourceClass"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/codehaus/jackson/JsonParseException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 87
    invoke-virtual {p1}, Lcom/openfeint/internal/resource/ResourceClass;->factory()Lcom/openfeint/internal/resource/Resource;

    move-result-object v8

    .line 89
    .local v8, resource:Lcom/openfeint/internal/resource/Resource;
    :goto_0
    iget-object v9, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v9}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v9

    sget-object v10, Lorg/codehaus/jackson/JsonToken;->FIELD_NAME:Lorg/codehaus/jackson/JsonToken;

    if-eq v9, v10, :cond_0

    .line 120
    iget-object v9, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v9}, Lorg/codehaus/jackson/JsonParser;->getCurrentToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v9

    sget-object v10, Lorg/codehaus/jackson/JsonToken;->END_OBJECT:Lorg/codehaus/jackson/JsonToken;

    if-eq v9, v10, :cond_7

    .line 121
    new-instance v9, Lorg/codehaus/jackson/JsonParseException;

    new-instance v10, Ljava/lang/StringBuilder;

    const-string v11, "Expected END_OBJECT of "

    invoke-direct {v10, v11}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v11, p1, Lcom/openfeint/internal/resource/ResourceClass;->mResourceName:Ljava/lang/String;

    invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v10

    invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v10

    iget-object v11, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v11}, Lorg/codehaus/jackson/JsonParser;->getCurrentLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v11

    invoke-direct {v9, v10, v11}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v9

    .line 90
    :cond_0
    iget-object v9, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v9}, Lorg/codehaus/jackson/JsonParser;->getText()Ljava/lang/String;

    move-result-object v3

    .line 91
    .local v3, name:Ljava/lang/String;
    iget-object v9, p1, Lcom/openfeint/internal/resource/ResourceClass;->mProperties:Ljava/util/HashMap;

    invoke-virtual {v9, v3}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Lcom/openfeint/internal/resource/ResourceProperty;

    .line 92
    .local v6, prop:Lcom/openfeint/internal/resource/ResourceProperty;
    if-nez v6, :cond_1

    .line 94
    iget-object v9, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v9}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    .line 95
    iget-object v9, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v9}, Lorg/codehaus/jackson/JsonParser;->skipChildren()Lorg/codehaus/jackson/JsonParser;

    goto :goto_0

    .line 96
    :cond_1
    instance-of v9, v6, Lcom/openfeint/internal/resource/PrimitiveResourceProperty;

    if-eqz v9, :cond_2

    .line 97
    move-object v0, v6

    check-cast v0, Lcom/openfeint/internal/resource/PrimitiveResourceProperty;

    move-object v5, v0

    .line 98
    .local v5, pprop:Lcom/openfeint/internal/resource/PrimitiveResourceProperty;
    iget-object v9, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v9}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    .line 99
    iget-object v9, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v5, v8, v9}, Lcom/openfeint/internal/resource/PrimitiveResourceProperty;->parse(Lcom/openfeint/internal/resource/Resource;Lorg/codehaus/jackson/JsonParser;)V

    goto :goto_0

    .line 100
    .end local v5           #pprop:Lcom/openfeint/internal/resource/PrimitiveResourceProperty;
    :cond_2
    instance-of v9, v6, Lcom/openfeint/internal/resource/NestedResourceProperty;

    if-eqz v9, :cond_4

    .line 101
    move-object v0, v6

    check-cast v0, Lcom/openfeint/internal/resource/NestedResourceProperty;

    move-object v4, v0

    .line 102
    .local v4, nprop:Lcom/openfeint/internal/resource/NestedResourceProperty;
    invoke-virtual {v4}, Lcom/openfeint/internal/resource/NestedResourceProperty;->getType()Ljava/lang/Class;

    move-result-object v9

    invoke-static {v9}, Lcom/openfeint/internal/resource/Resource;->getKlass(Ljava/lang/Class;)Lcom/openfeint/internal/resource/ResourceClass;

    move-result-object v7

    .line 103
    .local v7, rc:Lcom/openfeint/internal/resource/ResourceClass;
    if-eqz v7, :cond_3

    .line 104
    invoke-direct {p0, v7}, Lcom/openfeint/internal/JsonResourceParser;->parseResource(Lcom/openfeint/internal/resource/ResourceClass;)Lcom/openfeint/internal/resource/Resource;

    move-result-object v9

    invoke-virtual {v4, v8, v9}, Lcom/openfeint/internal/resource/NestedResourceProperty;->set(Lcom/openfeint/internal/resource/Resource;Lcom/openfeint/internal/resource/Resource;)V

    goto :goto_0

    .line 106
    :cond_3
    const-string v9, "JsonResourceParser"

    new-instance v10, Ljava/lang/StringBuilder;

    const-string v11, "unknown "

    invoke-direct {v10, v11}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4}, Lcom/openfeint/internal/resource/NestedResourceProperty;->getType()Ljava/lang/Class;

    move-result-object v11

    invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v10

    invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v10

    invoke-static {v9, v10}, Lcom/openfeint/internal/OpenFeintInternal;->log(Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_0

    .line 108
    .end local v4           #nprop:Lcom/openfeint/internal/resource/NestedResourceProperty;
    .end local v7           #rc:Lcom/openfeint/internal/resource/ResourceClass;
    :cond_4
    instance-of v9, v6, Lcom/openfeint/internal/resource/ArrayResourceProperty;

    if-eqz v9, :cond_5

    .line 109
    move-object v0, v6

    check-cast v0, Lcom/openfeint/internal/resource/ArrayResourceProperty;

    move-object v1, v0

    .line 110
    .local v1, aprop:Lcom/openfeint/internal/resource/ArrayResourceProperty;
    invoke-direct {p0}, Lcom/openfeint/internal/JsonResourceParser;->parseArray()Ljava/util/ArrayList;

    move-result-object v9

    invoke-virtual {v1, v8, v9}, Lcom/openfeint/internal/resource/ArrayResourceProperty;->set(Lcom/openfeint/internal/resource/Resource;Ljava/util/List;)V

    goto/16 :goto_0

    .line 111
    .end local v1           #aprop:Lcom/openfeint/internal/resource/ArrayResourceProperty;
    :cond_5
    instance-of v9, v6, Lcom/openfeint/internal/resource/HashIntResourceProperty;

    if-eqz v9, :cond_6

    .line 112
    move-object v0, v6

    check-cast v0, Lcom/openfeint/internal/resource/HashIntResourceProperty;

    move-object v2, v0

    .line 113
    .local v2, hprop:Lcom/openfeint/internal/resource/HashIntResourceProperty;
    invoke-direct {p0}, Lcom/openfeint/internal/JsonResourceParser;->parseHash()Ljava/util/HashMap;

    move-result-object v9

    invoke-virtual {v2, v8, v9}, Lcom/openfeint/internal/resource/HashIntResourceProperty;->set(Lcom/openfeint/internal/resource/Resource;Ljava/util/HashMap;)V

    goto/16 :goto_0

    .line 115
    .end local v2           #hprop:Lcom/openfeint/internal/resource/HashIntResourceProperty;
    :cond_6
    const-string v9, "JsonResourceParser"

    const-string v10, "Totally don\'t know what to do about this property"

    invoke-static {v9, v10}, Lcom/openfeint/internal/OpenFeintInternal;->log(Ljava/lang/String;Ljava/lang/String;)V

    .line 116
    iget-object v9, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v9}, Lorg/codehaus/jackson/JsonParser;->skipChildren()Lorg/codehaus/jackson/JsonParser;

    goto/16 :goto_0

    .line 123
    .end local v3           #name:Ljava/lang/String;
    .end local v6           #prop:Lcom/openfeint/internal/resource/ResourceProperty;
    :cond_7
    return-object v8
.end method

.method private parseResource()Lcom/openfeint/internal/resource/Resource;
    .locals 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/codehaus/jackson/JsonParseException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 147
    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v3

    sget-object v4, Lorg/codehaus/jackson/JsonToken;->FIELD_NAME:Lorg/codehaus/jackson/JsonToken;

    if-eq v3, v4, :cond_0

    new-instance v3, Lorg/codehaus/jackson/JsonParseException;

    const-string v4, "Couldn\'t find wrapper object."

    iget-object v5, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v5}, Lorg/codehaus/jackson/JsonParser;->getTokenLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v5

    invoke-direct {v3, v4, v5}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v3

    .line 148
    :cond_0
    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->getText()Ljava/lang/String;

    move-result-object v0

    .line 149
    .local v0, className:Ljava/lang/String;
    invoke-static {v0}, Lcom/openfeint/internal/resource/Resource;->getKlass(Ljava/lang/String;)Lcom/openfeint/internal/resource/ResourceClass;

    move-result-object v1

    .line 150
    .local v1, klass:Lcom/openfeint/internal/resource/ResourceClass;
    if-nez v1, :cond_1

    new-instance v3, Lorg/codehaus/jackson/JsonParseException;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Don\'t know class \'"

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, "\'."

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    iget-object v5, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v5}, Lorg/codehaus/jackson/JsonParser;->getTokenLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v5

    invoke-direct {v3, v4, v5}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v3

    .line 151
    :cond_1
    invoke-direct {p0, v1}, Lcom/openfeint/internal/JsonResourceParser;->parseResource(Lcom/openfeint/internal/resource/ResourceClass;)Lcom/openfeint/internal/resource/Resource;

    move-result-object v2

    .line 152
    .local v2, rv:Lcom/openfeint/internal/resource/Resource;
    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v3

    sget-object v4, Lorg/codehaus/jackson/JsonToken;->END_OBJECT:Lorg/codehaus/jackson/JsonToken;

    if-eq v3, v4, :cond_2

    new-instance v3, Lorg/codehaus/jackson/JsonParseException;

    const-string v4, "Expected only one k/v in wrapper object."

    iget-object v5, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v5}, Lorg/codehaus/jackson/JsonParser;->getTokenLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v5

    invoke-direct {v3, v4, v5}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v3

    .line 153
    :cond_2
    return-object v2
.end method

.method private parseResource(Lcom/openfeint/internal/resource/ResourceClass;)Lcom/openfeint/internal/resource/Resource;
    .locals 4
    .parameter "resourceClass"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/codehaus/jackson/JsonParseException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 76
    iget-object v1, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v1}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v0

    .line 77
    .local v0, tok:Lorg/codehaus/jackson/JsonToken;
    sget-object v1, Lorg/codehaus/jackson/JsonToken;->VALUE_NULL:Lorg/codehaus/jackson/JsonToken;

    if-ne v0, v1, :cond_0

    const/4 v1, 0x0

    .line 82
    :goto_0
    return-object v1

    .line 79
    :cond_0
    sget-object v1, Lorg/codehaus/jackson/JsonToken;->START_OBJECT:Lorg/codehaus/jackson/JsonToken;

    if-eq v0, v1, :cond_1

    .line 80
    new-instance v1, Lorg/codehaus/jackson/JsonParseException;

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "Expected START_OBJECT of "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v3, p1, Lcom/openfeint/internal/resource/ResourceClass;->mResourceName:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->getCurrentLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v3

    invoke-direct {v1, v2, v3}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v1

    .line 82
    :cond_1
    invoke-direct {p0, p1}, Lcom/openfeint/internal/JsonResourceParser;->parseOpenedResource(Lcom/openfeint/internal/resource/ResourceClass;)Lcom/openfeint/internal/resource/Resource;

    move-result-object v1

    goto :goto_0
.end method


# virtual methods
.method public parse()Ljava/lang/Object;
    .locals 8
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/codehaus/jackson/JsonParseException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 29
    iget-object v5, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v5}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v1

    .line 30
    .local v1, firstTok:Lorg/codehaus/jackson/JsonToken;
    if-nez v1, :cond_0

    .line 33
    const/4 v5, 0x0

    .line 57
    :goto_0
    return-object v5

    .line 36
    :cond_0
    sget-object v5, Lorg/codehaus/jackson/JsonToken;->START_OBJECT:Lorg/codehaus/jackson/JsonToken;

    if-eq v1, v5, :cond_1

    new-instance v5, Lorg/codehaus/jackson/JsonParseException;

    const-string v6, "Couldn\'t find toplevel wrapper object."

    iget-object v7, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v7}, Lorg/codehaus/jackson/JsonParser;->getTokenLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v7

    invoke-direct {v5, v6, v7}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v5

    .line 37
    :cond_1
    iget-object v5, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v5}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v5

    sget-object v6, Lorg/codehaus/jackson/JsonToken;->FIELD_NAME:Lorg/codehaus/jackson/JsonToken;

    if-eq v5, v6, :cond_2

    new-instance v5, Lorg/codehaus/jackson/JsonParseException;

    const-string v6, "Couldn\'t find toplevel wrapper object."

    iget-object v7, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v7}, Lorg/codehaus/jackson/JsonParser;->getTokenLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v7

    invoke-direct {v5, v6, v7}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v5

    .line 38
    :cond_2
    iget-object v5, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v5}, Lorg/codehaus/jackson/JsonParser;->getText()Ljava/lang/String;

    move-result-object v0

    .line 40
    .local v0, classOrArrayName:Ljava/lang/String;
    const/4 v3, 0x0

    .line 42
    .local v3, rv:Ljava/lang/Object;
    iget-object v5, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v5}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v4

    .line 43
    .local v4, tok:Lorg/codehaus/jackson/JsonToken;
    sget-object v5, Lorg/codehaus/jackson/JsonToken;->START_ARRAY:Lorg/codehaus/jackson/JsonToken;

    if-ne v4, v5, :cond_3

    .line 45
    invoke-direct {p0}, Lcom/openfeint/internal/JsonResourceParser;->parseOpenedArray()Ljava/util/ArrayList;

    move-result-object v3

    .line 55
    .end local v3           #rv:Ljava/lang/Object;
    :goto_1
    iget-object v5, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v5}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v5

    sget-object v6, Lorg/codehaus/jackson/JsonToken;->END_OBJECT:Lorg/codehaus/jackson/JsonToken;

    if-eq v5, v6, :cond_6

    new-instance v5, Lorg/codehaus/jackson/JsonParseException;

    const-string v6, "Expected only one k/v in toplevel wrapper object."

    iget-object v7, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v7}, Lorg/codehaus/jackson/JsonParser;->getTokenLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v7

    invoke-direct {v5, v6, v7}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v5

    .line 46
    .restart local v3       #rv:Ljava/lang/Object;
    :cond_3
    sget-object v5, Lorg/codehaus/jackson/JsonToken;->START_OBJECT:Lorg/codehaus/jackson/JsonToken;

    if-ne v4, v5, :cond_5

    .line 48
    invoke-static {v0}, Lcom/openfeint/internal/resource/Resource;->getKlass(Ljava/lang/String;)Lcom/openfeint/internal/resource/ResourceClass;

    move-result-object v2

    .line 49
    .local v2, klass:Lcom/openfeint/internal/resource/ResourceClass;
    if-nez v2, :cond_4

    new-instance v5, Lorg/codehaus/jackson/JsonParseException;

    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "Unknown toplevel class \'"

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v6, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, "\'."

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    iget-object v7, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v7}, Lorg/codehaus/jackson/JsonParser;->getTokenLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v7

    invoke-direct {v5, v6, v7}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v5

    .line 50
    :cond_4
    invoke-direct {p0, v2}, Lcom/openfeint/internal/JsonResourceParser;->parseOpenedResource(Lcom/openfeint/internal/resource/ResourceClass;)Lcom/openfeint/internal/resource/Resource;

    move-result-object v3

    .local v3, rv:Lcom/openfeint/internal/resource/Resource;
    goto :goto_1

    .line 52
    .end local v2           #klass:Lcom/openfeint/internal/resource/ResourceClass;
    .local v3, rv:Ljava/lang/Object;
    :cond_5
    new-instance v5, Lorg/codehaus/jackson/JsonParseException;

    const-string v6, "Expected object or array at top level."

    iget-object v7, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v7}, Lorg/codehaus/jackson/JsonParser;->getTokenLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v7

    invoke-direct {v5, v6, v7}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v5

    .end local v3           #rv:Ljava/lang/Object;
    :cond_6
    move-object v5, v3

    .line 57
    goto/16 :goto_0
.end method

.method public parse(Lcom/openfeint/internal/resource/ResourceClass;)Ljava/lang/Object;
    .locals 4
    .parameter "resourceClass"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/codehaus/jackson/JsonParseException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 62
    iget-object v1, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v1}, Lorg/codehaus/jackson/JsonParser;->nextToken()Lorg/codehaus/jackson/JsonToken;

    move-result-object v0

    .line 63
    .local v0, firstTok:Lorg/codehaus/jackson/JsonToken;
    if-nez v0, :cond_0

    .line 66
    const/4 v1, 0x0

    .line 70
    :goto_0
    return-object v1

    .line 69
    :cond_0
    sget-object v1, Lorg/codehaus/jackson/JsonToken;->START_OBJECT:Lorg/codehaus/jackson/JsonToken;

    if-eq v0, v1, :cond_1

    new-instance v1, Lorg/codehaus/jackson/JsonParseException;

    const-string v2, "Couldn\'t find toplevel wrapper object."

    iget-object v3, p0, Lcom/openfeint/internal/JsonResourceParser;->mParser:Lorg/codehaus/jackson/JsonParser;

    invoke-virtual {v3}, Lorg/codehaus/jackson/JsonParser;->getTokenLocation()Lorg/codehaus/jackson/JsonLocation;

    move-result-object v3

    invoke-direct {v1, v2, v3}, Lorg/codehaus/jackson/JsonParseException;-><init>(Ljava/lang/String;Lorg/codehaus/jackson/JsonLocation;)V

    throw v1

    .line 70
    :cond_1
    invoke-direct {p0, p1}, Lcom/openfeint/internal/JsonResourceParser;->parseOpenedResource(Lcom/openfeint/internal/resource/ResourceClass;)Lcom/openfeint/internal/resource/Resource;

    move-result-object v1

    goto :goto_0
.end method
